package com.itheima.mapper;


import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.itheima.domain.combat.Questionnaire;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Options;
import org.apache.ibatis.annotations.Select;

public interface QuestionnaireMapper extends BaseMapper<Questionnaire> {
    ////根据级别查询问卷
    @Select("SELECT * FROM tb_questionnaire WHERE level = #{strLevel}")
    Questionnaire findByLevel(String strLevel);
    //根据主键查询问卷
    @Select("SELECT * FROM tb_questionnaire WHERE id = #{questionnaireId}")
    Questionnaire findId(Integer questionnaireId);
    //保存问卷
    @Insert("insert into tb_questionnaire (id, name,cover,level,star) values (null, #{name}, #{cover}, #{level}, #{star})")
    @Options(useGeneratedKeys=true, keyProperty="id", keyColumn="id")
    void saveQuestionnaire(Questionnaire questionnaire);
}
